class FragebogenSbpController < ApplicationController 
  layout "layouts/fragebogen" ,  :except => [:export,:test]

  def index
    # redirect_to :template => 'fragebogen/home' 
    render :template => '../../public/pages/home.html'
  end

  # GETs should be safe 
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }

  def export
    headers['Content-Type'] = "application/vnd.ms-excel" 
    headers['Content-Disposition'] = 'attachment; filename="excel-export.xls"'
    headers['Cache-Control'] = ''
    @records = Fragebogen.find(:all)
  end
  
  def list
    @fragebogen_sbp_pages, @fragebogen_sbps = paginate :fragebogen_sbps, :per_page => 10
  end

  def show
    @fragebogen_sbp = FragebogenSbp.find(params[:id])
  end

  def new
    @fragebogen_sbp = FragebogenSbp.new
  end

  def create
    @fragebogen_sbp = FragebogenSbp.new(params[:fragebogen_sbp])
    if @fragebogen_sbp.save
      flash[:notice] = 'FragebogenSbp was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @fragebogen_sbp = FragebogenSbp.find(params[:id])
  end

  def update
    @fragebogen_sbp = FragebogenSbp.find(params[:id])
    if @fragebogen_sbp.update_attributes(params[:fragebogen_sbp])
      flash[:notice] = 'FragebogenSbp was successfully updated.'
      redirect_to :action => 'show', :id => @fragebogen_sbp
    else
      render :action => 'edit'
    end
  end

  def destroy
    FragebogenSbp.find(params[:id]).destroy
    redirect_to :action => 'list'
  end
end
